﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entetities;
using System.Data;
using System.Data.SqlClient;


namespace DAL
{
    public class CartItemDAL
    {
        private DataHelper dh;
        public CartItemDAL()
        {
            dh = new DataHelper();
        }
        public CartItem getSanPham(int masp)
        {
            DataTable bang=new DataTable();
            SqlParameter para = new SqlParameter("masp", masp);
            bang = dh.FieldSortTableSP("sp_get_sanpham_giohang", para);
            CartItem item = null;

            if (bang.Rows.Count > 0)
            {
                item = new CartItem();
                DataRow row=bang.Rows[0];
                item.Masanpham = (int)row["Masanpham"];
                item.Tensanpham = row["Tensanpham"].ToString();
                item.Giaban = (decimal)row["Giaban"];
                item.hinh = row["Hinhthunho"].ToString();

            }
            return item;
        }
    }
}
